<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <script src="/static/jquery-1.11.3.js"></script>
    <script>
        $(function () {
            $('#login').click(function () {
                var $usernameInput = $('#username');
                var $passwordInput = $('#password');
                var u = $usernameInput.val();
                var p = $passwordInput.val();
                var param = {username: u, password: p};
                console.log(param);
                $.get('/denglu', param, function (data) {
                    if (data.success) {
                        location.href = 'chaxun.html'
                    } else {
                        $('#result').html(data.msg).css('color', 'red')
                    }
                })
            })
        })
    </script>
</head>
<body>
<h1>欢迎登录</h1>
<span id="result"></span><br>
用户名：<input type="text" name="username" id="username"><br>
密码：<input type="text" name="password" id="password"><br>
<button id="login">登陆</button>
</body>
</html>